package liuyang.bigeventserver.modules.article.validation;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

/**
 * @author xconf
 * @since 2024/3/3
 */
public class StateValidation implements ConstraintValidator<State, String> {
    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        if (null == value) {
            //return false;
            return true; // 202403031410 最终是希望如果该参数传了才判断其内容是否合规。所以修改自定义的@State
        }

        if (value.equals("已发布") || value.equals("草稿")) {
            return true;
        }

        return false;
    }
}
